package scau.erps.view.decision.finance;

import scau.erps.app.Erps;
import scau.erps.service.LoanService;
import scau.erps.service.impl.LoanServiceImpl;

/**
 * 短贷财务面板
 * @author DCJ
 *
 */
public class ShortLoanFinancePanel extends SandPanelTemplateOfFinance {

	private static final long serialVersionUID = 1L;
	public ShortLoanFinancePanel(){
		super();
		this.label2.setVisible(true);
		this.label2.setText("利息:");
		this.textField2.setVisible(true);
		this.label3.setVisible(true);
		this.label3.setText("长短贷:");
		this.textField3.setVisible(true);
		this.label4.setVisible(true);
		this.label4.setText("权益:");
		this.textField4.setVisible(true);
		this.setTextFieldValue();
			
	}
	@Override
	public void setTextFieldValue() {
		this.cash.setText(Integer.toString(Erps.getSand().getCash()));
		this.textField2.setText(Integer.toString(Erps.getSand().getInterest()));	
		LoanService loanService = Erps.getIocInstance().get(LoanServiceImpl.class);
		int shortLoanAmount = loanService.getLoanAmount(Erps.getCurrentTeam().getId(), "短贷");
		int longLoanAmount = loanService.getLoanAmount(Erps.getCurrentTeam().getId(), "长贷");
		this.textField3.setText(Integer.toString(shortLoanAmount+longLoanAmount));
		// TODO 从数据库中取得权益
	}
}
